﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel;

namespace RiskMan.DataClass.Models.NotBasModels
{
    public class Statistics : INotifyPropertyChanged
    {

        #region private

        private double _amountProfit;
        private int _amountDeals;
        private DateTime _dateStartTrade;
        private double _middlePriceOpen;
        private double _middlePriceClose;
        private int _volOpen;
        private int _volClose;

        #endregion

        #region public

        /// <summary>
        /// Объем закрытых позиций
        /// </summary>
        public int VolClose
        {
            get { return _volClose; }
            set
            {
                if (_volClose != value)
                {
                    _volClose = value;
                    RaisePropertyChanged("VolClose");
                }
            }
        }

        /// <summary>
        /// Объем открытых позиций
        /// </summary>
        public int VolOpen
        {
            get { return _volOpen; }
            set
            {
                if (_volOpen != value)
                {
                    _volOpen = value;
                    RaisePropertyChanged("VolOpen");
                }
            }
        }

        /// <summary>
        /// Средняя цена закрытия
        /// </summary>
        public double MiddlePriceClose
        {
            get { return _middlePriceClose; }
            set
            {
                if (_middlePriceClose != value)
                {
                    _middlePriceClose = value;
                    RaisePropertyChanged("MiddlePriceClose");
                }
            }
        }

        /// <summary>
        /// Средняя цена открытия
        /// </summary>
        public double MiddlePriceOpen
        {
            get { return _middlePriceOpen; }
            set
            {
                if (_middlePriceOpen != value)
                {
                    _middlePriceOpen = value;
                    RaisePropertyChanged("MiddlePriceOpen");
                }
            }
        }

        /// <summary>
        /// Дата и время начала торгов по данному инструменту
        /// </summary>
        public DateTime DateStartTrade
        {
            get { return _dateStartTrade; }
            set
            {
                if (_dateStartTrade != value)
                {
                    _dateStartTrade = value;
                    RaisePropertyChanged("DateStartTrade");
                }
            }
        }

        /// <summary>
        /// общий финансвоый результат по сделкам Profti/Loss
        /// </summary>
        public double AmountProfit
        {
            get { return _amountProfit; }
            set
            {
                if (_amountProfit != value)
                {
                    _amountProfit = value;
                    RaisePropertyChanged("AmountProfit");
                }
            }
        }

        /// <summary>
        /// Количество сделок по инструменту
        /// </summary>
        public int AmountDeals
        {
            get { return _amountDeals; }
            set
            {
                if (_amountDeals != value)
                {
                    _amountDeals = value;
                    RaisePropertyChanged("AmountDeals");
                }
            }
        }

        #endregion

        #region event PropertyChangedEventHandler

        public event PropertyChangedEventHandler PropertyChanged;

        protected void RaisePropertyChanged(string propertyName)
        {
            var handler = PropertyChanged;
            if (handler != null)
            {
                handler(this, new PropertyChangedEventArgs(propertyName));
            }
        }

        #endregion
    }
}
